//
//  ViewController.m
//  Homework 2016-06-14
//
//  Created by Roach on 16/6/14.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "ViewController.h"
#import "GestureImageView.h"
#import "SecondViewController.h"

@interface ViewController ()<jumpDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    
    self.title = @"首页";
//    [self button];
    [self creatGsetureImageView];
    
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}
// 创建手势视图？
- (void)creatGsetureImageView {
    
    NSString *path = [[NSBundle mainBundle]pathForResource:@"a1" ofType:@"jpg"];
    GestureImageView *gesture = [[GestureImageView alloc]initWithImage:[UIImage imageWithContentsOfFile:path] withFrame:CGRectMake(80, 150, 90, 110)];
    [self.view addSubview:gesture];
    [gesture release];
    
    NSString *path2 = [[NSBundle mainBundle]pathForResource:@"a2" ofType:@"jpg"];
    GestureImageView *gesture2 = [[GestureImageView alloc]initWithImage:[UIImage imageWithContentsOfFile:path2] withFrame:CGRectMake(180, 150, 90, 110)];
    [self.view addSubview:gesture2];
    [gesture2 release];
    
    NSString *path3 = [[NSBundle mainBundle]pathForResource:@"a3" ofType:@"jpg"];
    GestureImageView *gesture3 = [[GestureImageView alloc]initWithImage:[UIImage imageWithContentsOfFile:path3] withFrame:CGRectMake(80, 270, 90, 110)];
    [self.view addSubview:gesture3];
    [gesture3 release];
    
    NSString *path4 = [[NSBundle mainBundle]pathForResource:@"a4" ofType:@"jpg"];
    GestureImageView *gesture4 = [[GestureImageView alloc]initWithImage:[UIImage imageWithContentsOfFile:path4] withFrame:CGRectMake(180, 270, 90, 110)];
    [self.view addSubview:gesture4];
    [gesture4 release];
    
    NSString *path5 = [[NSBundle mainBundle]pathForResource:@"a5" ofType:@"jpg"];
    GestureImageView *gesture5 = [[GestureImageView alloc]initWithImage:[UIImage imageWithContentsOfFile:path5] withFrame:CGRectMake(80, 390, 90, 110)];
    [self.view addSubview:gesture5];
    [gesture5 release];
    
    NSString *path6 = [[NSBundle mainBundle]pathForResource:@"a6" ofType:@"jpg"];
    GestureImageView *gesture6 = [[GestureImageView alloc]initWithImage:[UIImage imageWithContentsOfFile:path6] withFrame:CGRectMake(180, 390, 90, 110)];
    [self.view addSubview:gesture6];
    [gesture6 release];
    
    gesture.delegate = self;
    gesture2.delegate = self;
    gesture3.delegate = self;
    gesture4.delegate = self;
    gesture5.delegate = self;
    gesture6.delegate = self;
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)button {
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(50, 50, 50, 50);
    button.backgroundColor = [UIColor redColor];
    [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:button];
    
}

// 跳转
- (void)jump {
    
    SecondViewController *secondVC = [[SecondViewController alloc]init];
    [self.navigationController pushViewController:secondVC animated:YES];
    [secondVC release];
    
}

- (void)buttonAction:(UIButton *)button {
    SecondViewController *secondView = [[SecondViewController alloc]init];
    [self.navigationController pushViewController:secondView animated:YES];
    
}

@end
